import { request } from '@/utils/request';

// const departListApi = {
//     queryDepartTree: '/ww_depart/tree'
// }
/**
 * 部门树
 * @param params 
 * @returns 
 */
export function queryDepartTree(params:API.DepartListParams) {
    return request({
        url: '/ww_depart/tree',
        method: 'get',
        params,
    });
}

/**
 * 部门人员树
 * @param params 
 * @returns 
 */
export function queryDepartUserTree(params:API.DepartListParams) {
    return request({
        url: '/ww_depart/departUserTree',
        method: 'get',
        params,
    });
}


/**
 * 部门id查询人员信息
 * @param params 
 * @returns 
 */
export function queryUser(params:API.UserListParams) {
    return request({
        url: '/ww_depart/leaderList',
        method: 'get',
        params,
    });
}

/**
 * 新增部门     
 * @param params 
 * @returns 
 */
export function saveDepart(data:API.SaveDepartBody) {
    return request({
        url: '/ww_depart/save',
        method: 'post',
        data:data,
    });
}
/**
 * 删除部门
 * @param params 
 * @returns 
 */
export function deleteDepart(params:API.DeleteDepartParams) {
    return request({
        url: '/ww_depart/delete',
        method: 'post',
        params,
    });
}
/**
 * 修改该部门名称
 * @param params 
 * @returns 
 */
export function updateDepart(data:API.UpdataDepartBody) {
    return request({
        url: '/ww_depart/rename',
        method: 'post',
        data:data,
    });
}
/**
 * 节点拖拽功能
 * @param data 
 * @returns 
 */
export function dragDepart(data:API.DragDepartBody) {
    return request({
        url: '/ww_depart/sort',
        method: 'post',
        data:data,
    });
}

/**
 * 通过 父级id 查询 子部门id
 * @param params 
 * @returns 
 */
export function querychildrn(params:API.QuerychildrnParams) {
    return request({
        url: '/ww_depart/querychildrn',
        method: 'get',
        params,
    });
}


/**
 * 从部门中批量移除成员
 * @param params 
 * @returns 
 */
export function batchRemove(data:API.BatchRemoveParams) {
    return request({
        url: '/ww_user/batchRemove',
        method: 'post',
        data:data,
    });
}

/**
 * 当前部门添加人员
 * @param data 
 * @returns 
 */
export function departmentUsers(data:API.DepartmentUsersBody) {
    return request({
        url: '/ww_depart/departmentUsers',
        method: 'post',
        data:data,
    });
}

/**
 * 查询不在当前部门的其他人员
 * @param params 
 * @returns 
 */
export function queryUsers(params:API.QueryUsersParams) {
    return request({
        url: '/ww_depart/queryUsers',
        method: 'get',
        params,
    });
}



















